package com.linciping.useges.plugin.bean;

import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.search.SearchScope;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class PsiMergeDirectory implements PsiDirectory {

    private final String name;
    private final PsiDirectory psiDirectoryDelegate;

    public PsiMergeDirectory(String name, PsiDirectory psiDirectoryDelegate) {
        this.name = name;
        this.psiDirectoryDelegate = psiDirectoryDelegate;
    }

    @Override
    public @NotNull VirtualFile getVirtualFile() {
        return psiDirectoryDelegate.getVirtualFile();
    }

    @Override
    public @NotNull String getName() {
        return name + "." + psiDirectoryDelegate.getName();
    }

    @Override
    public @Nullable ItemPresentation getPresentation() {
        return psiDirectoryDelegate.getPresentation();
    }

    @Override
    public boolean processChildren(@NotNull PsiElementProcessor<? super PsiFileSystemItem> processor) {
        return psiDirectoryDelegate.processChildren(processor);
    }

    @Override
    public @NotNull PsiElement setName(@NotNull String name) throws IncorrectOperationException {
        return psiDirectoryDelegate.setName(name);
    }

    @Override
    public @Nullable PsiDirectory getParentDirectory() {
        return psiDirectoryDelegate.getParentDirectory();
    }

    @Override
    public boolean isDirectory() {
        return psiDirectoryDelegate.isDirectory();
    }

    @Override
    public @NotNull Project getProject() throws PsiInvalidElementAccessException {
        return psiDirectoryDelegate.getProject();
    }

    @Override
    public @NotNull Language getLanguage() {
        return psiDirectoryDelegate.getLanguage();
    }

    @Override
    public PsiManager getManager() {
        return psiDirectoryDelegate.getManager();
    }

    @Override
    public PsiElement @NotNull [] getChildren() {
        return psiDirectoryDelegate.getChildren();
    }

    @Override
    public @Nullable PsiDirectory getParent() {
        return psiDirectoryDelegate.getParent();
    }

    @Override
    public PsiElement getFirstChild() {
        return psiDirectoryDelegate.getFirstChild();
    }

    @Override
    public PsiElement getLastChild() {
        return psiDirectoryDelegate.getLastChild();
    }

    @Override
    public PsiElement getNextSibling() {
        return psiDirectoryDelegate.getNextSibling();
    }

    @Override
    public PsiElement getPrevSibling() {
        return psiDirectoryDelegate.getPrevSibling();
    }

    @Override
    public PsiFile getContainingFile() throws PsiInvalidElementAccessException {
        return psiDirectoryDelegate.getContainingFile();
    }

    @Override
    public TextRange getTextRange() {
        return psiDirectoryDelegate.getTextRange();
    }

    @Override
    public int getStartOffsetInParent() {
        return psiDirectoryDelegate.getStartOffsetInParent();
    }

    @Override
    public int getTextLength() {
        return psiDirectoryDelegate.getTextLength();
    }

    @Override
    public @Nullable PsiElement findElementAt(int offset) {
        return psiDirectoryDelegate.findElementAt(offset);
    }

    @Override
    public @Nullable PsiReference findReferenceAt(int offset) {
        return psiDirectoryDelegate.findReferenceAt(offset);
    }

    @Override
    public int getTextOffset() {
        return psiDirectoryDelegate.getTextOffset();
    }

    @Override
    public @NlsSafe String getText() {
        return psiDirectoryDelegate.getText();
    }

    @Override
    public char @NotNull [] textToCharArray() {
        return psiDirectoryDelegate.textToCharArray();
    }

    @Override
    public PsiElement getNavigationElement() {
        return psiDirectoryDelegate.getNavigationElement();
    }

    @Override
    public PsiElement getOriginalElement() {
        return psiDirectoryDelegate.getOriginalElement();
    }

    @Override
    public boolean textMatches(@NotNull @NonNls CharSequence text) {
        return psiDirectoryDelegate.textMatches(text);
    }

    @Override
    public boolean textMatches(@NotNull PsiElement element) {
        return psiDirectoryDelegate.textMatches(element);
    }

    @Override
    public boolean textContains(char c) {
        return psiDirectoryDelegate.textContains(c);
    }

    @Override
    public void accept(@NotNull PsiElementVisitor visitor) {
        psiDirectoryDelegate.accept(visitor);
    }

    @Override
    public void acceptChildren(@NotNull PsiElementVisitor visitor) {
        psiDirectoryDelegate.acceptChildren(visitor);
    }

    @Override
    public PsiElement copy() {
        return psiDirectoryDelegate.copy();
    }

    @Override
    public PsiElement add(@NotNull PsiElement element) throws IncorrectOperationException {
        return psiDirectoryDelegate.add(element);
    }

    @Override
    public PsiElement addBefore(@NotNull PsiElement element, @Nullable PsiElement anchor) throws IncorrectOperationException {
        return psiDirectoryDelegate.addBefore(element, anchor);
    }

    @Override
    public PsiElement addAfter(@NotNull PsiElement element, @Nullable PsiElement anchor) throws IncorrectOperationException {
        return psiDirectoryDelegate.addAfter(element, anchor);
    }

    @Override
    public void checkAdd(@NotNull PsiElement element) throws IncorrectOperationException {
        psiDirectoryDelegate.checkAdd(element);
    }

    @Override
    public PsiElement addRange(PsiElement first, PsiElement last) throws IncorrectOperationException {
        return psiDirectoryDelegate.addRange(first, last);
    }

    @Override
    public PsiElement addRangeBefore(@NotNull PsiElement first, @NotNull PsiElement last, PsiElement anchor) throws IncorrectOperationException {
        return psiDirectoryDelegate.addRangeBefore(first, last, anchor);
    }

    @Override
    public PsiElement addRangeAfter(PsiElement first, PsiElement last, PsiElement anchor) throws IncorrectOperationException {
        return psiDirectoryDelegate.addRangeAfter(first, last, anchor);
    }

    @Override
    public void delete() throws IncorrectOperationException {
        psiDirectoryDelegate.delete();
    }

    @Override
    public void checkDelete() throws IncorrectOperationException {
        psiDirectoryDelegate.checkDelete();
    }

    @Override
    public void deleteChildRange(PsiElement first, PsiElement last) throws IncorrectOperationException {
        psiDirectoryDelegate.deleteChildRange(first, last);
    }

    @Override
    public PsiElement replace(@NotNull PsiElement newElement) throws IncorrectOperationException {
        return psiDirectoryDelegate.replace(newElement);
    }

    @Override
    public boolean isValid() {
        return psiDirectoryDelegate.isValid();
    }

    @Override
    public boolean isWritable() {
        return psiDirectoryDelegate.isWritable();
    }

    @Override
    public @Nullable PsiReference getReference() {
        return psiDirectoryDelegate.getReference();
    }

    @Override
    public PsiReference @NotNull [] getReferences() {
        return psiDirectoryDelegate.getReferences();
    }

    @Override
    public <T> @Nullable T getCopyableUserData(@NotNull Key<T> key) {
        return psiDirectoryDelegate.getCopyableUserData(key);
    }

    @Override
    public <T> void putCopyableUserData(@NotNull Key<T> key, @Nullable T value) {
        psiDirectoryDelegate.putCopyableUserData(key, value);
    }

    @Override
    public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, @Nullable PsiElement lastParent, @NotNull PsiElement place) {
        return psiDirectoryDelegate.processDeclarations(processor, state, lastParent, place);
    }

    @Override
    public @Nullable PsiElement getContext() {
        return psiDirectoryDelegate.getContext();
    }

    @Override
    public boolean isPhysical() {
        return psiDirectoryDelegate.isPhysical();
    }

    @Override
    public @NotNull GlobalSearchScope getResolveScope() {
        return psiDirectoryDelegate.getResolveScope();
    }

    @Override
    public @NotNull SearchScope getUseScope() {
        return psiDirectoryDelegate.getUseScope();
    }

    @Override
    public ASTNode getNode() {
        return psiDirectoryDelegate.getNode();
    }

    @Override
    public boolean isEquivalentTo(PsiElement another) {
        return psiDirectoryDelegate.isEquivalentTo(another);
    }

    @Override
    public PsiDirectory @NotNull [] getSubdirectories() {
        return psiDirectoryDelegate.getSubdirectories();
    }

    @Override
    public PsiFile @NotNull [] getFiles() {
        return psiDirectoryDelegate.getFiles();
    }

    @Override
    public @Nullable PsiDirectory findSubdirectory(@NonNls @NotNull String name) {
        return psiDirectoryDelegate.findSubdirectory(name);
    }

    @Override
    public @Nullable PsiFile findFile(@NotNull @NonNls String name) {
        return psiDirectoryDelegate.findFile(name);
    }

    @Override
    public @NotNull PsiDirectory createSubdirectory(@NotNull String name) throws IncorrectOperationException {
        return psiDirectoryDelegate.createSubdirectory(name);
    }

    @Override
    public void checkCreateSubdirectory(@NotNull String name) throws IncorrectOperationException {
        psiDirectoryDelegate.checkCreateSubdirectory(name);
    }

    @Override
    public @NotNull PsiFile createFile(@NotNull @NonNls String name) throws IncorrectOperationException {
        return psiDirectoryDelegate.createFile(name);
    }

    @Override
    public @NotNull PsiFile copyFileFrom(@NotNull String newName, @NotNull PsiFile originalFile) throws IncorrectOperationException {
        return psiDirectoryDelegate.copyFileFrom(newName, originalFile);
    }

    @Override
    public void checkCreateFile(@NotNull String name) throws IncorrectOperationException {
        psiDirectoryDelegate.checkCreateFile(name);
    }

    @Override
    public void navigate(boolean requestFocus) {
        psiDirectoryDelegate.navigate(requestFocus);
    }

    @Override
    public boolean canNavigate() {
        return psiDirectoryDelegate.canNavigate();
    }

    @Override
    public boolean canNavigateToSource() {
        return psiDirectoryDelegate.canNavigateToSource();
    }

    @Override
    public void checkSetName(String name) throws IncorrectOperationException {
        psiDirectoryDelegate.checkSetName(name);
    }

    @Override
    public Icon getIcon(int flags) {
        return psiDirectoryDelegate.getIcon(flags);
    }

    @Override
    public <T> @Nullable T getUserData(@NotNull Key<T> key) {
        return psiDirectoryDelegate.getUserData(key);
    }

    @Override
    public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
        psiDirectoryDelegate.putUserData(key, value);
    }
}
